﻿using Hotel.Model;

namespace Hotel.DAL
{
    public class AdminDAL
    {
        public AdminDAL(HotelContext hotelContext)
        {
            HotelContext = hotelContext;
        }

        public HotelContext HotelContext { get; }


        //登录
        public dynamic Login(string name,string pwd)
        {
            var count = HotelContext.AdminInfo.Where(x=>x.UserName == name).FirstOrDefault();
            if (count == null )
            {
                return -1; //账号不存在
            }
            if (count.UserPwd != pwd)
            {
                return -2;//密码错误
            }
            else
            {
                return count;//登录成功返回对象
            }
        }

    }
}
